# coding: utf-8
"""
创建批量测试的Excel模板文件
"""
import pandas as pd
import json

# 示例数据
data = {
    'session_id': ['test_001', 'test_002', 'test_003'],
    'input_value': [
        '患者姓名：张三，已婚',
        '患者姓名：李四，未婚',
        '患者信息：王五，男，35岁，已婚'
    ],
    'SchemaBlueprint.my_json_schema[NestedDict]': [
        json.dumps({
            "schema": {
                "type": "object",
                "properties": {
                    "姓名": {"type": "string", "description": "患者姓名"},
                    "婚否": {"type": "string", "description": "患者是否已婚,['已婚' / '未婚']"}
                },
                "required": ["姓名"],
                "additionalProperties": False
            },
            "name": "jsonEntity",
            "strict": True
        }, ensure_ascii=False),
        json.dumps({
            "schema": {
                "type": "object",
                "properties": {
                    "姓名": {"type": "string", "description": "患者姓名"},
                    "婚否": {"type": "string", "description": "患者是否已婚,['已婚' / '未婚']"}
                },
                "required": ["姓名"],
                "additionalProperties": False
            },
            "name": "jsonEntity",
            "strict": True
        }, ensure_ascii=False),
        json.dumps({
            "schema": {
                "type": "object",
                "properties": {
                    "姓名": {"type": "string", "description": "患者姓名"},
                    "性别": {"type": "string", "description": "患者性别"},
                    "年龄": {"type": "integer", "description": "患者年龄"},
                    "婚否": {"type": "string", "description": "患者是否已婚,['已婚' / '未婚']"}
                },
                "required": ["姓名"],
                "additionalProperties": False
            },
            "name": "jsonEntity",
            "strict": True
        }, ensure_ascii=False)
    ]
}

# 创建DataFrame
df = pd.DataFrame(data)

# 保存为Excel
output_file = 'langflow_batch_template.xlsx'
df.to_excel(output_file, index=False, engine='openpyxl')

print(f"✅ 模板文件已创建: {output_file}")
print(f"📊 包含 {len(df)} 行示例数据")
print("\n列说明:")
print("  - session_id: 会话ID（可选）")
print("  - input_value: 输入文本（必需）")
print("  - SchemaBlueprint.my_json_schema[NestedDict]: 组件参数示例")
